package gov.police.diary.service.impl;

import gov.police.diary.dao.HeadquaterDao;
import gov.police.diary.model.PolHeadquater;
import gov.police.diary.service.HeadquaterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author nmduc
 */
@Service("HeadquaterService")
public class HeadquaterServiceImpl implements HeadquaterService {

    @Autowired
    private HeadquaterDao headquaterDao;

    public PolHeadquater getHeadquater() {

        PolHeadquater headquater = this.headquaterDao.getHeadquater(1);
        if (headquater == null) {
            headquater = new PolHeadquater();
            headquater.setIdHeadquater(1);
            this.headquaterDao.saveHeadquater(headquater);
        }
        return headquater;
    }

    public void updateHeadquater(PolHeadquater department) {
        this.headquaterDao.updateHeadquater(department);
    }

    public HeadquaterDao getHeadquaterDao() {
        return headquaterDao;
    }

    public void setHeadquaterDao(HeadquaterDao headquaterDao) {
        this.headquaterDao = headquaterDao;
    }
}
